package org.dromara.tearoom.domain.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;
import org.dromara.common.core.enums.ArrayValuable;

import java.util.Arrays;

/**
 * 团购核销关联类型
 *
 * @author ckj
 */
@AllArgsConstructor
@Getter
public enum GroupBuyRelateTypeEnum implements ArrayValuable<Integer> {

    COUPON(1, "优惠劵"),
    GOOD(2, "商品");

    /**
     * 类型
     */
    private final Integer type;

    /**
     * 描述
     */
    private final String description;

    public static final Integer[] ARRAYS = Arrays.stream(values()).map(GroupBuyRelateTypeEnum::getType).toArray(Integer[]::new);

    @Override
    public Integer[] array() {
        return ARRAYS;
    }

    /**
     * 判断是否是优惠券
     *
     * @param type 类型
     * @return 判断是否是优惠券
     */
    public static boolean isCoupon(Integer type) {
        return COUPON.getType().equals(type);
    }



}
